//
//  HusbandInfoVC.m
//  Doctor
//
//  Created by 阳光 on 16/9/28.
//  Copyright © 2016年 阳光. All rights reserved.
//  丈夫生育状况调查结果

#import "HusbandInfoVC.h"

@interface HusbandInfoVC ()

@property(nonatomic,strong)UIScrollView *scrollView;

@property(nonatomic,strong)UIView *mainView;

@end

@implementation HusbandInfoVC

- (void)viewDidLoad {
    [super viewDidLoad];
  
    [self initNavBarBtnItem];
    
    self.title=@"丈夫生育状况调查";
    
    [self initScrollView];
    
}

-(void)initScrollView
{
    _scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0,0,APPW,APPH-64)];
    _scrollView.backgroundColor=WhiteColor;
    _scrollView.showsVerticalScrollIndicator=NO;
    [self.view addSubview:_scrollView];
    
    _mainView=[self setMainView];
    setViewCoord_Y(_mainView,0);
    [_scrollView addSubview:_mainView];
    _scrollView.contentSize=CGSizeMake(APPW,CGRectGetMaxY(self.mainView.frame)+kmargin);
    
}

-(UIView *)setMainView
{
    UIView *mainView=[[UIView alloc]initWithFrame:CGRectMake(0,0,APPW,0)];
    mainView.backgroundColor=WhiteColor;
    
    UIView *topLine=[UIView new];
    [mainView addSubview:topLine];
    topLine.backgroundColor=MAIN_BACK_COLOR;
    [topLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(APPW,1));
        make.top.mas_equalTo(0);
    }];
    
    setViewHeight_Add(mainView,kmargin+1);

    UILabel *tipLabel=[mainView getLabelWithText:@"曾做过的检查如下:" font:Font_Number(14) textColor:Main_Color textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
    [mainView addSubview:tipLabel];
    [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(kmargin);
        make.size.mas_equalTo(CGSizeMake(APPW-kmargin*2,kmargin*2));
    }];
    setViewHeight_Add(mainView,kmargin*3);
    
    NSArray *titleArr=@[@"精子分析",@"抗精子抗体",@"精子穿透检测"];
    NSArray *dayArr=@[@"检查日期",@"检查日期",@"检查日期"];
    NSArray *dayRArr=@[_patientInfoDic[@"sperm_date"],_patientInfoDic[@"a_sperm_date"],_patientInfoDic[@"sperm_through_date"]];
    NSArray *resultArr=@[@"检查结果",@"检查结果",@"检查结果"];
    NSArray *resultRArr=@[_patientInfoDic[@"sperm_result"],_patientInfoDic[@"a_sperm_result"],_patientInfoDic[@"sperm_through_result"]];
    for (int i=0;i<3;i++)
    {
        UILabel *titleLabel=[mainView getLabelWithText:titleArr[i] font:Font_Number(15) textColor:Main_Color textAlignment:NSTextAlignmentCenter lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        titleLabel.frame=CGRectMake(0,mainView.frame.size.height+(i%3)*110,APPW,kmargin*3);
        [mainView addSubview:titleLabel];
        
        UILabel *dayLabel=[mainView getLabelWithText:dayArr[i] font:Font_Number(13) textColor:Color000000 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        dayLabel.frame=CGRectMake(kmargin,mainView.frame.size.height+(i%3)*110+kmargin*3,APPW/2,kmargin*3);
        [mainView addSubview:dayLabel];
        
        UILabel *dayRLabel=[mainView getLabelWithText:dayRArr[i] font:Font_Number(13) textColor:Color000000 textAlignment:NSTextAlignmentRight lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        dayRLabel.frame=CGRectMake(APPW/2,mainView.frame.size.height+(i%3)*110+kmargin*3,APPW/2-kmargin,kmargin*3);
        [mainView addSubview:dayRLabel];
        
        UILabel *resultLabel=[mainView getLabelWithText:resultArr[i] font:Font_Number(13) textColor:Color000000 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        resultLabel.frame=CGRectMake(kmargin,mainView.frame.size.height+(i%3)*110+kmargin*6,APPW/2,kmargin*3);
        [mainView addSubview:resultLabel];
        
        UILabel *resultRLabel=[mainView getLabelWithText:resultRArr[i] font:Font_Number(13) textColor:Color000000 textAlignment:NSTextAlignmentRight lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        resultRLabel.frame=CGRectMake(APPW/2,mainView.frame.size.height+(i%3)*110+kmargin*6,APPW/2-kmargin,kmargin*3);
        [mainView addSubview:resultRLabel];
        
        UIView *lineView=[[UIView alloc]initWithFrame:CGRectMake(0,mainView.frame.size.height+(i%3)*110+kmargin*9+kmargin/2,APPW,kmargin)];
        lineView.backgroundColor=MAIN_BACK_COLOR;
        [mainView addSubview:lineView];
    }
    
     setViewHeight_Add(mainView,110*3);
    
    return mainView;
}

-(void)initNavBarBtnItem
{
    self.navigationItem.leftBarButtonItem=[UIBarButtonItem initWithNormalImage:@"back_gray" target:self action:@selector(backItemEvent)];
}

-(void)backItemEvent
{
    [self.navigationController popViewControllerAnimated:NO];
}

@end
